//
//  LikeTableViewCell.m
//  Movie
//
//  Created by cjy on 16/4/1.
//  Copyright © 2016年 HY. All rights reserved.
//

#import "LikeTableViewCell.h"
#import "MovieModel.h"
#import <UIImageView+WebCache.h>

@implementation LikeTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        _imageForSave = [[UIImageView alloc]init];
        [self.contentView addSubview:_imageForSave];
        
        
        _labelForTitle =[[UILabel alloc]init];
        [self.imageForSave addSubview:_labelForTitle];

    }
    
    return self;

}


- (void)layoutSubviews{
    [super layoutSubviews];
    self.imageForSave.frame = CGRectMake(0, 0,self.contentView.frame.size.width, 200);
    
    self.labelForTitle.frame = CGRectMake(100, 100, self.frame.size.width - 10, 50);
    self.labelForTitle.center = self.imageForSave.center;
    self.labelForTitle.textAlignment = NSTextAlignmentCenter;
    self.labelForTitle.font = [UIFont boldSystemFontOfSize:18];
    self.labelForTitle.textColor = [UIColor whiteColor];
    self.labelForTitle.shadowColor = [UIColor blackColor];
    self.labelForTitle.shadowOffset = CGSizeMake(0.6, 0.6);
}

- (void)passModel:(MovieModel *)model{
    
    
    [self.imageForSave sd_setImageWithURL:[NSURL URLWithString:model.coverForDetail]placeholderImage:[UIImage imageNamed:@"jz"]];
    
    _labelForTitle.text = model.title;
    _labelForTitle.numberOfLines = 0;
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
